package com.tbit.uqbike.object.business;

import com.tbit.uqbike.object.pojo.MachineShortInfo;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * @author MyWin E-mail:335918956@qq.com
 * @version 1.0
 * @createTime 2019-12-28 16:31
 * 常规权限判定函数
 */
public class PurviewHelper {
    /**
     * 过滤出无权限操作的编号
     *
     * @param user2Machine
     * @param codes
     * @return
     */
    public static List<String> filterNoRightCode(User2Machine user2Machine, List<String> codes) {
        List<String> noRightList = new LinkedList<>();
        Map<String, MachineShortInfo> codeMap = user2Machine.getCodeMap();
        for (String item : codes) {
            if (!codeMap.containsKey(item)) {
                noRightList.add(item);
            }
        }
        return noRightList;
    }
}
